package cn.wolfcode.shop.cloud.redis.key;

import lombok.Getter;
import org.apache.commons.lang.StringUtils;

import java.util.concurrent.TimeUnit;

/**
 * Created by wolfcode-lanxw
 */
@Getter
public enum UserRedisKey {
    USER_TOKEN("userToken:", 30L, TimeUnit.MINUTES);

    private String prefix;
    private long expireTime;
    private TimeUnit unit;

    UserRedisKey(String prefix, long expireTime, TimeUnit unit) {
        this.prefix = prefix;
        this.expireTime = expireTime;
        this.unit = unit;
    }

    public String join(String...keys) {
        return this.prefix + ":" + StringUtils.join(keys, ":");
    }
}
